<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );


/**
 * @package		Joomla
 * @subpackage	JobBoard
 */
class JobBoardTableJA_Codes extends JTable
{
	/** @var int Primary key */
	var $id				= null;
	/** @var string */					
	var $value 			= null;
	/** @var int */
	var $text		= null;
	/** @var string */  
	var $field_id		= null;
	
	/**
	* @param database A database connector object
	*/
	function __construct(&$db)
	{
		parent::__construct( '#__ja_codes', 'id', $db );
	}		
	
	/**
	 * Overloaded check function
	 *
	 * @access public
	 * @return boolean
	 * @see JTable::check
	 * @since 1.5
	 */
	function check()
	{		
		JFilterOutput::objectHTMLSafe($this,ENT_QUOTES,'');
		if(empty($this->value)){
			$this->setError('Value empty');
		}
		if(empty($this->text)){
			$this->setError('Text empty');
			return false;
		}
		
		return true;
	}
	function load($key)
	{
		parent::load($key);
		$this->value = JFilterInput::_decode($this->value);
		$this->value = JFilterInput::clean($this->value);
		$this->text = JFilterInput::_decode($this->text);
		$this->text = JFilterInput::clean($this->text);
		return $this;
	}
}